package com.apchernykh.rozhlasapp.player;

import android.os.Handler;

/**
 * Provides simplified interface for the media player.
 * Runs in a separate service.
 * Behind this interface, there will be:
 * 1. Media player, with a workaround for AAC progressive stream
 * 2. Set of stub players, for unit testing of the application core
 * 
 * There are several states of the player:
 * 1. Stopped
 * 2. Prepare
 * 3. Playing
 * 4. Paused
 * 
 */
public interface IPlayer {

	/**
	 * Factory. 
	 * 0 - returns media player.
	 * 1-x returns all kinds of stub players for testing. 
	 * */
	public IPlayer getInstance(int iPlayerType);
	
	/**
	 * Sets the location to play
	 * */
	public void setUrl(String iUrl);

	
	/**
	 * Adds the handler to notify when an error is occured.
	 * This is not for working around an error, but just 
	 * for asynchronous notification 
	 * 
	 * */
	public void addOnStateChange(Handler iHandler);

	/**
	 * Starts playback
	 * */
	public void start();

	/**
	 * Stops playback
	 * */
	public void stop();

	/**
	 * Pauses the playback
	 * */
	public void pause();

	/**
	 * Returns an estimation of the consumed bitrate 
	 * */
	public int getConsumedBitRate();

}
